package com.example.huaweiod.practice;

import java.util.Scanner;

public class hj2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine().toLowerCase();
        char c = in.nextLine().toLowerCase().charAt(0);
        int ans = 0;
        for (int i = 0; i < s.length(); i++) {
            if (c == s.charAt(i)) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}
